<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 对象解构
      const course = {
        name: 'es6',
        price: 500,
        teacher: {
          name: 'xx',
          age: 34
        }
      }
      const {
        name: courseName,
        price,
        teacher: { name, age }
      } = course
      console.log('courseName', courseName)
      console.log('price', price)
      console.log('tearcher.name/age', name, age)

      // 数组解构
      const courseArr = ['es6', 'es7', 'es8']
      const [a, b, c] = courseArr
      console.log('a, b, c', a, b, c)
    </script>
  </body>
</html>
